Skip to content

fix(core): Attach debug_meta to Hermes JS error events via Debug ID lookup - #6545

Open
antonis wants to merge 5 commits into
mainfrom
fix/6480-debug-meta-hermes
Open

fix(core): Attach debug_meta to Hermes JS error events via Debug ID lookup#6545
antonis wants to merge 5 commits into
mainfrom
fix/6480-debug-meta-hermes

Conversation

@antonis

@antonis antonis commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

📢 Type of change

  • Bugfix

📜 Description

On React Native + Hermes (including Expo OTA / expo export Hermes bundles), plain JS exception events often ship without debug_meta.images, even when Metro injected the Debug ID premodule (_sentryDebugIds) and the matching artifact bundle was uploaded with that Debug ID.

The core prepareEvent pipeline attempts this via applyDebugIdsapplyDebugMeta, but that path re-parses the premodule Error().stack and requires an exact filename match against the exception frames. That match is fragile for Hermes premodule stacks, so filenameDebugIdMap ends up empty and no debug_meta is attached.

Profiling already solves the same problem robustly via getDebugMetadata() (profiling/debugid.ts): it reads _sentryDebugIds directly and stamps a single sourcemap image with the canonical bundle code_file (app:///index.android.bundle / app:///main.jsbundle) — no stack reparse. That helper was not wired into the error event pipeline.

This PR adds a default debugMetaIntegration that reuses getDebugMetadata() to stamp debug_meta.images on error events. Key details:

  • Scoped to error events (event.type === undefined) — transactions, profiles and other event types are untouched.
  • Idempotent against core. Core runs applyDebugIds (sets frame.debug_id) before event processors and applyDebugMeta (stamps images) after them. The integration detects a successful core match via frame.debug_id and backs off, so core's own stamp is not duplicated. When core fails to match (the bug case), the integration fills the gap.
  • Defensive dedupe by debug_id, and preserves unrelated pre-existing images (e.g. native images added by nativeLinkedErrors).
  • Registered right after createReactNativeRewriteFrames() so the canonical bundle filename is already in place.

💡 Motivation and Context

Without debug_meta, backends fall back to release + filename matching. RN/Expo rewrites every JS frame to the same canonical filename, and OTA updates keep the native release, so the native build's Hermes map can be applied to OTA bytecode → wrong files/lines. The missing debug_meta is an SDK-side gap regardless of backend.

Fixes #6480

💚 How did you test it?

  • Added test/integrations/debugmeta.test.ts covering: stamping on error events, no-op when no Debug ID, skipping non-error events, backing off when core matched, and preserving pre-existing images.
  • Added tests that reproduce the core prepareEvent ordering (applyDebugIds → event processor → applyDebugMeta) and assert exactly one image results whether core succeeds or fails — guarding against a duplicate-image regression.
  • Regenerated the API report for the new public debugMetaIntegration.

📝 Checklist

  • I added tests to verify changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • All tests passing.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.
  • No breaking changes.

🔮 Next steps

  • Confirm naming (debugMetaIntegration) — the mechanism is RN/Hermes-specific (single bundle per platform); a more specific name could be used if preferred.

🤖 Generated with Claude Code

…ookup

Error events relied on the core applyDebugIds path, which re-parses the
Metro-injected premodule Error().stack and requires an exact filename
match against the exception frames. That match is fragile for Hermes
premodule stacks, so events frequently shipped without debug_meta and
symbolication fell back to release + filename matching (broken for
Expo OTA updates that keep the native release).

Add a debugMetaIntegration that reuses profiling's direct Debug ID
lookup (getDebugMetadata) to stamp debug_meta.images for error events.
It backs off when core already matched the stack (frame.debug_id set)
to avoid emitting a duplicate image, and dedupes defensively.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


  • fix(core): Attach debug_meta to Hermes JS error events via Debug ID lookup by antonis in #6545
  • fix(expo): resolve plugin config when registered as bare '@sentry/react-native' by antonis in #6543
  • fix(ios): make the RNSentry SPEC CHECKSUM in Podfile.lock machine-independent by alwx in #6534
  • chore(deps): update Android SDK to v8.51.0 by github-actions in #6539
  • chore(deps): update Sentry Android Gradle Plugin to v6.17.0 by github-actions in #6544
  • feat(core): Extend TurboModule instrumentation to legacy NativeModules by alwx in #6504
  • feat(ios): Introduce enableMetricKit option by alwx in #6540

🤖 This preview updates automatically when you update the PR.

@antonis
antonis force-pushed the fix/6480-debug-meta-hermes branch from 073c8a0 to f40d5e0 Compare July 30, 2026 15:51
@antonis antonis added the ready-to-merge Triggers the full CI test suite label Jul 30, 2026
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@antonis

antonis commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

@sentry review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 3b10f42. Configure here.

@sentry

sentry Bot commented Jul 30, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
Sentry RN io.sentry.reactnative.sample 8.21.0 (101) Release

⚙️ sentry-react-native Build Distribution Settings

@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3867.30 ms 1221.30 ms -2646.00 ms
Size 4.98 MiB 6.56 MiB 1.58 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
61cc206+dirty 3849.70 ms 1230.33 ms -2619.38 ms
5a21b51+dirty 3823.11 ms 1214.46 ms -2608.65 ms
038a6d7+dirty 3849.69 ms 1228.40 ms -2621.28 ms
3817909+dirty 1183.90 ms 1187.50 ms 3.60 ms
d7d54c6+dirty 3827.13 ms 1217.18 ms -2609.95 ms
0bd8916+dirty 3842.33 ms 1230.76 ms -2611.58 ms
a0d8cf8+dirty 3842.33 ms 1212.40 ms -2629.93 ms
af33f3b+dirty 3849.98 ms 1236.45 ms -2613.53 ms
5a316ea+dirty 3820.11 ms 1211.28 ms -2608.83 ms
7a89652+dirty 3861.46 ms 1229.61 ms -2631.85 ms

App size

Revision Plain With Sentry Diff
61cc206+dirty 4.98 MiB 6.55 MiB 1.57 MiB
5a21b51+dirty 5.15 MiB 6.67 MiB 1.51 MiB
038a6d7+dirty 5.15 MiB 6.70 MiB 1.55 MiB
3817909+dirty 3.38 MiB 4.73 MiB 1.35 MiB
d7d54c6+dirty 4.98 MiB 6.51 MiB 1.53 MiB
0bd8916+dirty 5.15 MiB 6.69 MiB 1.53 MiB
a0d8cf8+dirty 5.15 MiB 6.67 MiB 1.51 MiB
af33f3b+dirty 4.98 MiB 6.51 MiB 1.54 MiB
5a316ea+dirty 4.98 MiB 6.51 MiB 1.53 MiB
7a89652+dirty 5.15 MiB 6.70 MiB 1.55 MiB

Previous results on branch: fix/6480-debug-meta-hermes

Startup times

Revision Plain With Sentry Diff
384cb83+dirty 3856.39 ms 1219.55 ms -2636.84 ms

App size

Revision Plain With Sentry Diff
384cb83+dirty 4.98 MiB 6.56 MiB 1.58 MiB

@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3851.37 ms 1214.07 ms -2637.30 ms
Size 5.08 MiB 6.68 MiB 1.60 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
61cc206+dirty 3822.60 ms 1206.17 ms -2616.43 ms
b9bebee+dirty 3858.02 ms 1231.92 ms -2626.11 ms
2363c0f+dirty 3834.61 ms 1224.46 ms -2610.15 ms
038a6d7+dirty 3838.96 ms 1218.86 ms -2620.10 ms
7ff4d0f+dirty 3859.87 ms 1224.75 ms -2635.12 ms
d7d54c6+dirty 3842.44 ms 1204.87 ms -2637.57 ms
1122a96+dirty 3839.17 ms 1219.23 ms -2619.93 ms
23598c3+dirty 1223.59 ms 1229.13 ms 5.53 ms
af33f3b+dirty 3851.28 ms 1233.06 ms -2618.21 ms
5a316ea+dirty 3831.56 ms 1214.31 ms -2617.26 ms

App size

Revision Plain With Sentry Diff
61cc206+dirty 4.98 MiB 6.55 MiB 1.57 MiB
b9bebee+dirty 5.15 MiB 6.68 MiB 1.53 MiB
2363c0f+dirty 4.98 MiB 6.46 MiB 1.49 MiB
038a6d7+dirty 5.15 MiB 6.70 MiB 1.55 MiB
7ff4d0f+dirty 5.15 MiB 6.70 MiB 1.55 MiB
d7d54c6+dirty 4.98 MiB 6.51 MiB 1.53 MiB
1122a96+dirty 5.15 MiB 6.68 MiB 1.53 MiB
23598c3+dirty 3.38 MiB 4.80 MiB 1.42 MiB
af33f3b+dirty 4.98 MiB 6.51 MiB 1.54 MiB
5a316ea+dirty 4.98 MiB 6.51 MiB 1.53 MiB

Previous results on branch: fix/6480-debug-meta-hermes

Startup times

Revision Plain With Sentry Diff
384cb83+dirty 3844.38 ms 1221.17 ms -2623.21 ms

App size

Revision Plain With Sentry Diff
384cb83+dirty 4.98 MiB 6.56 MiB 1.58 MiB

@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Android (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 488.18 ms 529.24 ms 41.06 ms
Size 49.74 MiB 55.44 MiB 5.70 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
37a2091+dirty 407.82 ms 441.22 ms 33.40 ms
4acd4e9+dirty 414.45 ms 448.55 ms 34.10 ms
5b7e8a7+dirty 418.55 ms 488.46 ms 69.91 ms
21a1e70+dirty 405.72 ms 436.16 ms 30.44 ms
4e0b819+dirty 420.56 ms 470.08 ms 49.52 ms
774257e+dirty 407.09 ms 447.46 ms 40.37 ms
3b6e9f9+dirty 442.70 ms 486.44 ms 43.74 ms
23598c3+dirty 414.12 ms 426.24 ms 12.12 ms
7d6fd3a+dirty 403.02 ms 422.56 ms 19.54 ms
41d6254+dirty 424.45 ms 474.34 ms 49.89 ms

App size

Revision Plain With Sentry Diff
37a2091+dirty 48.30 MiB 53.58 MiB 5.28 MiB
4acd4e9+dirty 49.74 MiB 55.26 MiB 5.52 MiB
5b7e8a7+dirty 48.30 MiB 53.58 MiB 5.28 MiB
21a1e70+dirty 49.74 MiB 54.82 MiB 5.07 MiB
4e0b819+dirty 49.74 MiB 54.81 MiB 5.07 MiB
774257e+dirty 48.30 MiB 53.58 MiB 5.28 MiB
3b6e9f9+dirty 48.30 MiB 53.54 MiB 5.23 MiB
23598c3+dirty 43.75 MiB 48.16 MiB 4.41 MiB
7d6fd3a+dirty 43.75 MiB 48.14 MiB 4.39 MiB
41d6254+dirty 48.30 MiB 53.60 MiB 5.30 MiB

Previous results on branch: fix/6480-debug-meta-hermes

Startup times

Revision Plain With Sentry Diff
384cb83+dirty 423.51 ms 487.04 ms 63.53 ms

App size

Revision Plain With Sentry Diff
384cb83+dirty 49.74 MiB 55.38 MiB 5.64 MiB

@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Android (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 444.83 ms 478.30 ms 33.47 ms
Size 49.74 MiB 55.44 MiB 5.70 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
3d536d1+dirty 416.08 ms 448.45 ms 32.37 ms
88735e9+dirty 427.04 ms 487.37 ms 60.33 ms
b9bebee+dirty 500.50 ms 536.42 ms 35.92 ms
5748023+dirty 413.71 ms 468.71 ms 54.99 ms
ef27341+dirty 519.02 ms 553.42 ms 34.40 ms
5a21b51+dirty 505.16 ms 539.20 ms 34.04 ms
6177334+dirty 404.80 ms 456.74 ms 51.94 ms
7ac3378+dirty 410.67 ms 442.60 ms 31.92 ms
41d6254+dirty 406.20 ms 445.52 ms 39.32 ms
1122a96+dirty 510.16 ms 542.00 ms 31.84 ms

App size

Revision Plain With Sentry Diff
3d536d1+dirty 49.74 MiB 55.26 MiB 5.52 MiB
88735e9+dirty 49.74 MiB 54.82 MiB 5.07 MiB
b9bebee+dirty 48.30 MiB 53.58 MiB 5.28 MiB
5748023+dirty 48.30 MiB 53.54 MiB 5.23 MiB
ef27341+dirty 48.30 MiB 53.54 MiB 5.24 MiB
5a21b51+dirty 48.30 MiB 53.49 MiB 5.19 MiB
6177334+dirty 48.30 MiB 53.54 MiB 5.23 MiB
7ac3378+dirty 43.94 MiB 48.99 MiB 5.05 MiB
41d6254+dirty 48.30 MiB 53.60 MiB 5.30 MiB
1122a96+dirty 48.30 MiB 53.54 MiB 5.24 MiB

Previous results on branch: fix/6480-debug-meta-hermes

Startup times

Revision Plain With Sentry Diff
384cb83+dirty 425.08 ms 477.16 ms 52.08 ms

App size

Revision Plain With Sentry Diff
384cb83+dirty 49.74 MiB 55.38 MiB 5.64 MiB

@antonis
antonis marked this pull request as ready for review July 31, 2026 05:28
@antonis
antonis requested review from a team, alwx and lucas-zimerman as code owners July 31, 2026 05:28
@antonis antonis removed the ready-to-merge Triggers the full CI test suite label Jul 31, 2026
@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor
Fails
🚫 Pull request is not ready for merge, please add the "ready-to-merge" label to the pull request

Generated by 🚫 dangerJS against 9b3f3a6

@antonis antonis left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also fixed the duplicate fixes section with 9b3f3a6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JS exceptions often lack debug_meta on Hermes; profiling path already has a robust Debug ID lookup

1 participant